package com.changeover.gwt.connection.dispatcher.shared;

import net.customware.gwt.dispatch.client.DefaultExceptionHandler;
import net.customware.gwt.dispatch.client.DispatchAsync;
import net.customware.gwt.dispatch.client.standard.StandardDispatchAsync;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Dispatcher
 */
public class Dispatcher {

    public static <T extends Result> void execute(final Action<T> action, final AsyncCallback<T> callback) {
        DispatchAsync dispatchAsync = new StandardDispatchAsync(new DefaultExceptionHandler());
        dispatchAsync.execute(action, callback);
    }

}
